﻿#include "HeartBeatCodec.h"

#include "UdpCodec.h"
#include "Device.h"

HeartBeatCodec::HeartBeatCodec()
{

}

HeartBeatCodec::~HeartBeatCodec()
{}

void HeartBeatCodec::sendHeartBeat(uint deviceId, ushort msgId)
{
  udpCodec->code(deviceId,msgId,UdpCodec::HeartBeat,QByteArray(),true);
}

UdpCodec* HeartBeatCodec::getUdpCodec() const
{
  return udpCodec;
}

HeartBeatCodec* HeartBeatCodec::setUdpCodec(UdpCodec*const udpCodec)
{
  this->udpCodec=udpCodec;
  printInjection(this,udpCodec);
  return this;
}

void HeartBeatCodec::objectAutoInjection(QHash<QString,QObject*>* objMap)
{
  setUdpCodec(getObjFromMap<UdpCodec>(objMap));
}
